// var i;
// var AL_GAME_HUA_GameConst = require("./AL_GAME_HUA_GameConst");
// var AL_GAME_HUA_PlatformButton = require("./AL_GAME_HUA_PlatformButton");
// var AL_GAME_HUA_PlatformManager = require("./AL_GAME_HUA_PlatformManager");
// var u = cc._decorator;
// var p = u.ccclass;
// var f =
//     (u.property,
//     (function (e) {
//         function t() {
//             return (null !== e && e.apply(this, arguments)) || this;
//         }
//         __extends(t, e);
//         t.prototype.onLoad = function () {
//             "wx" == ailin_sdk_manager.getSysPlatformName() && AL_GAME_HUA_GameConst.GameConst.getInstance().club_enabled
//                 ? e.prototype.onLoad.call(this)
//                 : (this.node.active = !1);
//         };
//         t.prototype.chuangjian_anniu = function () {
//             return AL_GAME_HUA_PlatformManager.PlatformManager.getInstance().wx.createGameClubButton({
//                 type: "text",
//                 text: " ",
//                 style: {
//                     backgroundColor: "#00000001",
//                     color: "#ffffff01"
//                 },
//                 icon: "green"
//             });
//         };
//         return __decorate([p], t);
//     })(AL_GAME_HUA_PlatformButton.default));
// exports.default = f;


// 引入必要的模块
const GameConst = require("./AL_GAME_HUA_GameConst");
const PlatformButton = require("./AL_GAME_HUA_PlatformButton");
const PlatformManager = require("./AL_GAME_HUA_PlatformManager");

// 获取 Cocos Creator 装饰器
const { ccclass, property } = cc._decorator;

/**
 * 此类继承自 PlatformButton，并在特定平台上创建平台按钮。
 */
@ccclass
class ImprovedPlatformButton extends PlatformButton.default {
    /**
     * 生命周期 onLoad 方法，检查当前平台是否为微信，并根据条件激活该节点。
     */
    onLoad() {
        const isWxPlatform = ailin_sdk_manager.getSysPlatformName() === "wx";
        const isClubEnabled = GameConst.GameConst.getInstance().club_enabled;

        if (isWxPlatform && isClubEnabled) {
            super.onLoad();
        } else {
            this.node.active = false;
        }
    }

    /**
     * 创建一个游戏俱乐部按钮，仅在微信平台上可用。
     * @returns {object} 返回创建的按钮对象
     */
    chuangjian_anniu() {
        const wxInstance = PlatformManager.PlatformManager.getInstance().wx;

        return wxInstance.createGameClubButton({
            type: "text",
            text: " ",
            style: {
                backgroundColor: "#00000001",
                color: "#ffffff01"
            },
            icon: "green"
        });
    }
}

exports.default = ImprovedPlatformButton;